package com.upb.webserver.common.enums;
/**
 * node status(跟webase-chain-manager一致，但hyperledger-chain-manager要中转一下).
 */
public enum NodeStatusEnum {
    INITIALIZATION(0, "初始化"),
    RUNNING(1, "运行"),
    STOP(2, "停止"),
    DURING_UPGRADE(3, "升级中"),
    ;

    private byte id;
    private String description;

    NodeStatusEnum(int id, String description) {
        this.id = (byte) id;
        this.description = description;
    }


    /**
     * @param id
     * @return
     */
    public static NodeStatusEnum getById(byte id) {
        for (NodeStatusEnum value : NodeStatusEnum.values()) {
            if (value.id == id) {
                return value;
            }
        }
        return null;
    }

    public byte getId() {
        return this.id;
    }
}
